/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

Ext.QuickTips.init();
var _pageSize = 20;
var _pageSizeSmall = 10;

var fieldName = ['id', 'name', 'x', 'y', 'h', 'pointTypeId', 'pointType', 'pointType2Id', 'pointType2', 'voltageLevelId', 'voltageLevelName', 'status', 'note', 'updateTime',
    'creatTime', 'orgCode', 'deptId', 'fromId', 'lowerLimit', 'upperLimit', 'pointArea', 'pointPosition', 'userName', 'publicName', 'deviceId', 'code', 'company', 'installSite',
    'manufactoryName', 'model', 'commTypeName', 'mobileNo', 'ip', 'terminalNo', 'installTime', 'checkTime', 'effectTime', 'stopTime', 'stopReason', 'expireTime', 'produceTime', 'port',
    'uniqueCode', 'zbm', 'adminAreaCode', 'channel', 'runTime', 'subCompany', 'shortName', 'stationVoltageLevel', 'realName', 'deviceType', 'lastHBTime', 'lastUploadTime', 'lastTalk', "isOffline",'startStatusCh','reportStatusCh'];
var fieldLabel = ['ID', '监测点名称', '经度', '纬度', '高度', '监测点类型ID（类别1）', '监测点类型(类别1)', '电网类型ID（类别2）', '电网类别（类别2）', '电压等级ID', '电压等级', '状态',
    '备注', '记录的更新时间', '记录的创建时间', '机构编码', '所属部门编码', '上级监测点', '电压下限', '电压上限', '用户名称', '公变名称', '设备ID', '监测点编码', '供电局', '安装位置',
    '生产厂家', '装置型号', '通信方式', '通信卡号', 'IP地址', '终端编号', '安装日期', '校验日期', '生效日期', '停用日期', '停用原因', '有效期', '出厂日期', '端口', '唯一码', '组编码', '行政区域码',
    '通道', '投运日期', '部门分县局', '供电所', '所属变电站电压等级', '管理人员', '装置类别', '在线离线', '上报观测', '启用停用', '上次心跳时间', '上次上传数据时间', '最后通信时间'];


var loadServlet = basePath + 'servlet/system/PointLoad';

var theme = ' 监测点';

var _title = currentOrgName + theme + '展示';





var checkboxSel = new Ext.grid.CheckboxSelectionModel();
var store;
function buildWindow() {
    store = new Ext.data.JsonStore({
        url: loadServlet,
        root: 'data',
        idProperty: 'id',
        totalProperty: 'count',
        fields: fieldName
        , baseParams: {start: 0, limit: _pageSize, cmd: "run"}
        , autoLoad: true
    });

    var grid = new Ext.grid.GridPanel({
        title: _title,
        store: store,
        sm: checkboxSel,
        columns: [
            checkboxSel,
            {header: fieldLabel[0], sortable: true, dataIndex: fieldName[0], hidden: true},
            {header: '监测点编码', width: 100, sortable: true, dataIndex: 'code'},
            {header: '供电局', width: 100, sortable: true, dataIndex: 'company'},
            {header: '部门分县局', width: 100, sortable: true, dataIndex: 'subCompany'},
            {header: '监测点类型', width: 100, sortable: true, dataIndex: 'pointType'},
            {header: '电网类型', width: 100, sortable: true, dataIndex: 'pointType2'},
            {header: '监测点名称', width: 100, sortable: true, dataIndex: 'name'},
            {header: '启用停用', width: 80, sortable: true, dataIndex: 'startStatusCh' },
            {header: '上报观测', width: 80, sortable: true, dataIndex: 'reportStatusCh' },
            {header: '在线离线', width: 80, sortable: true, dataIndex: 'isOffline'},
            {header: '上次心跳时间', width: 80, sortable: true, dataIndex: 'lastHBTime', xtype: 'datecolumn', format: 'Y-m-d'},
            {header: '上次上传数据时间', width: 80, sortable: true, dataIndex: 'lastUploadTime', xtype: 'datecolumn', format: 'Y-m-d'},
            {header: '最后通信时间', width: 80, sortable: true, dataIndex: 'lastTalk', xtype: 'datecolumn', format: 'Y-m-d'},
            {header: '电压等级', width: 100, sortable: true, dataIndex: 'voltageLevelName', align: 'right'},
            {header: '电压上限', width: 100, sortable: true, dataIndex: 'upperLimit', xtype: 'numbercolumn', format: '0.00', align: 'right'},
            {header: '电压下限', width: 100, sortable: true, dataIndex: 'lowerLimit', xtype: 'numbercolumn', format: '0.00', align: 'right'},
            {header: '测点地域', width: 100, sortable: true, dataIndex: 'pointArea'},
            {header: '测点位置', width: 100, sortable: true, dataIndex: 'pointPosition'},
            {header: '供电所', width: 100, sortable: true, dataIndex: 'shortName'},
            {header: '所属变电站电压等级', width: 120, sortable: true, dataIndex: 'stationVoltageLevel'},
            {header: '用户名称', width: 120, sortable: true, dataIndex: 'userName'},
            {header: '公变名称', width: 120, sortable: true, dataIndex: 'publicName'},
            {header: '安装位置', width: 120, sortable: true, dataIndex: 'installSite'},
            {header: '生产厂家', width: 120, sortable: true, dataIndex: 'manufactoryName'},
            {header: '装置类别', width: 80, sortable: true, dataIndex: 'deviceType'},
            {header: '装置型号', width: 80, sortable: true, dataIndex: 'model'},
            {header: '通信方式', width: 80, sortable: true, dataIndex: 'commTypeName'},
            {header: '通信卡号', width: 120, sortable: true, dataIndex: 'mobileNo'},
            {header: 'IP地址', width: 120, sortable: true, dataIndex: 'ip'},
            {header: '终端编号', width: 80, sortable: true, dataIndex: 'terminalNo'},
            {header: '安装日期', width: 80, sortable: true, dataIndex: 'installTime', xtype: 'datecolumn', format: 'Y-m-d'},
            {header: '校验日期', width: 80, sortable: true, dataIndex: 'checkTime', xtype: 'datecolumn', format: 'Y-m-d'},
            {header: '生效日期', width: 80, sortable: true, dataIndex: 'effectTime', xtype: 'datecolumn', format: 'Y-m-d'},
            //{header: '投运日期', width: 120, sortable: true, dataIndex: 'runTime', xtype: 'datecolumn', format: 'Y-m-d'},
            {header: '停用日期', width: 80, sortable: true, dataIndex: 'stopTime', xtype: 'datecolumn', format: 'Y-m-d'},
            {header: '停用原因', width: 80, sortable: true, dataIndex: 'stopReason'},
            {header: '有效期', width: 80, sortable: true, dataIndex: 'expireTime', xtype: 'datecolumn', format: 'Y-m-d'},
            {header: '出厂日期', width: 80, sortable: true, dataIndex: 'produceTime', xtype: 'datecolumn', format: 'Y-m-d'},
            {header: '端口', width: 80, sortable: true, dataIndex: 'port'},
            {header: '唯一码', width: 120, sortable: true, dataIndex: 'uniqueCode'},
            {header: '组编码', width: 80, sortable: true, dataIndex: 'zbm'},
            {header: '行政区域码', width: 80, sortable: true, dataIndex: 'adminAreaCode'},
            {header: '通道', width: 80, sortable: true, dataIndex: 'channel'},
            {header: '管理人员', width: 80, sortable: true, dataIndex: 'realName'},
            {header: '备注', id: '备注', width: 80, sortable: true, dataIndex: 'note'}
        ],
        loadMask: true,
        tbar: tbarPoint,
        bbar: new Ext.PagingToolbar({
            pageSize: _pageSize,
            store: store,
            displayInfo: true,
            displayMsg: '显示记录：{0} - {1}   总记录：{2}',
            emptyMsg: "目前没有" + theme + '信息'
        })
    });
    var applicationUI = new Ext.Viewport({
        layout: "fit",
        items: [
            grid
        ]
    });
}
Ext.onReady(buildWindow);
